package dominio.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Entity;

@Entity
@Table (name ="Tarifa")
public class Tarifa implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer idTarifa;
	
	@OneToOne (cascade=CascadeType.ALL)
	@JoinColumn(name="idEmpresaTransporte", referencedColumnName="idEmpresaTransporte")
	private EmpresaTransporte empresaTransporte;
	
	@OneToOne (cascade = CascadeType.ALL)
	@JoinColumns({@JoinColumn(name="idCodigoPostal", referencedColumnName="idCodigoPostal"),
				  @JoinColumn(name="sector", referencedColumnName="sector")})
	private CodigoPostal codigoPostal;
	
	private float precio;

	public Tarifa() {
		super();
	}

	public Integer getIdTarifa() {
		return idTarifa;
	}

	public void setIdTarifa(Integer idTarifa) {
		this.idTarifa = idTarifa;
	}

	public EmpresaTransporte getEmpresaTransporte() {
		return empresaTransporte;
	}

	public void setEmpresaTransporte(EmpresaTransporte empresaTransporte) {
		this.empresaTransporte = empresaTransporte;
	}

	public CodigoPostal getCodigoPostal() {
		return codigoPostal;
	}

	public void setCodigoPostal(CodigoPostal codigoPostal) {
		this.codigoPostal = codigoPostal;
	}

	public float getPrecio() {
		return precio;
	}

	public void setPrecio(float precio) {
		this.precio = precio;
	}
	
}
